home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Sound / PreludeAMP / src / transform.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-25  |  42.9 KB  |  1,524 lines

  1.  
  2. /* this file is a part of amp software, (C) tomislav uzelac 1996,1997
  3. */
  4.  
  5. /* transform.c  imdct and polyphase(DCT) transforms
  6.  *
  7.  * Created by: tomislav uzelac  May 1996
  8.  * Karl Anders Oygard optimized this for speed, Mar 13 97
  9.  * Some optimisations based on ideas from Michael Hipp's mpg123 package
  10.  */
  11.  
  12. /*
  13.  * Comments for this file:
  14.  *
  15.  * The polyphase algorithm is clearly the most cpu consuming part of mpeg 1
  16.  * layer 3 decoding.  Thus, there has been some effort to optimise this
  17.  * particular algorithm.  Currently, everything has been kept in straight C
  18.  * with no assembler optimisations, but in order to provide efficient paths
  19.  * for different architectures, alternative implementations of some
  20.  * critical sections has been done.  You may want to experiment with these,
  21.  * to see which suits your architecture better.
  22.  *
  23.  * Selection of the different implementations is done with the following
  24.  * defines:
  25.  *
  26.  *     HAS_AUTOINCREMENT
  27.  *
  28.  *         Define this if your architecture supports preincrementation of
  29.  *         pointers when referencing (applies to e.g. 68k)
  30.  *
  31.  * For those who are optimising amp, check out the Pentium rdtsc code
  32.  * (define PENTIUM_RDTSC).  This code uses the rdtsc counter for showing
  33.  * how many cycles are spent in different parts of the code.
  34.  */
  35.  
  36. #include <math.h>
  37. #include <sys/types.h>
  38. #include <unistd.h>
  39. #include <string.h>
  40.  
  41. #include "audio.h"
  42. #include "getdata.h"
  43. #include "misc2.h"
  44.  
  45. #define TRANSFORM
  46. #include "transform.h"
  47.  
  48. #define PI12      0.261799387f
  49. #define PI36      0.087266462f
  50.  
  51. void imdct_init()
  52. {
  53.   int i;
  54.  
  55.   for(i=0;i<36;i++) /* 0 */
  56.     win[0][i] = (float) sin(PI36 *(i+0.5));
  57.   for(i=0;i<18;i++) /* 1 */
  58.     win[1][i] = (float) sin(PI36 *(i+0.5));
  59.   for(i=18;i<24;i++)
  60.     win[1][i] = 1.0f;
  61.   for(i=24;i<30;i++)
  62.     win[1][i] = (float) sin(PI12 *(i+0.5-18));
  63.   for(i=30;i<36;i++)
  64.     win[1][i] = 0.0f;
  65.   for(i=0;i<6;i++) /* 3 */
  66.     win[3][i] = 0.0f;
  67.   for(i=6;i<12;i++)
  68.     win[3][i] = (float) sin(PI12 * (i+ 0.5 - 6.0));
  69.   for(i=12;i<18;i++)
  70.     win[3][i] = 1.0f;
  71.   for(i=18;i<36;i++)
  72.     win[3][i] = (float) sin(PI36 * (i + 0.5));
  73. }
  74.  
  75. /* This uses Byeong Gi Lee's Fast Cosine Transform algorithm to decompose
  76.    the 36 point and 12 point IDCT's into 9 point and 3 point IDCT's,
  77.    respectively. Then the 9 point IDCT is computed by a modified version of
  78.    Mikko Tommila's IDCT algorithm, based on the WFTA. See his comments
  79.    before the first 9 point IDCT. The 3 point IDCT is already efficient to
  80.    implement. -- Jeff Tsay. */
  81. /* I got the unrolled IDCT from Jeff Tsay; the code is presumably by 
  82.    Francois-Raymond Boyer - I unrolled it a little further. tu */
  83.  
  84. void imdct(int win_type,int sb,int ch)
  85. {
  86. /*------------------------------------------------------------------*/
  87. /*                                                                  */
  88. /*    Function: Calculation of the inverse MDCT                     */
  89. /*    In the case of short blocks the 3 output vectors are already  */
  90. /*    overlapped and added in this modul.                           */
  91. /*                                                                  */
  92. /*    New layer3                                                    */
  93. /*                                                                  */
  94. /*------------------------------------------------------------------*/
  95.  
  96.        float tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11;
  97.  
  98.        register float  save;
  99.        float  pp1, pp2;
  100.        float   *win_bt;
  101.        int     i, p, ss;
  102.          float *in = xr[ch][sb];
  103.          float *s_p = s[ch][sb];
  104.          float *res_p = res[sb];
  105.          float out[36];
  106.  
  107.    if(win_type == 2){
  108.         for(p=0;p<36;p+=9) {
  109.             out[p]   = out[p+1] = out[p+2] = out[p+3] =
  110.             out[p+4] = out[p+5] = out[p+6] = out[p+7] =
  111.             out[p+8] = 0.0f;
  112.         }
  113.  
  114.     for(ss=0;ss<18;ss+=6) {
  115.  
  116.     /*
  117.      *  12 point IMDCT
  118.      */
  119.  
  120.             /* Begin 12 point IDCT */
  121.  
  122.             /* Input aliasing for 12 pt IDCT */
  123.         in[5+ss]+=in[4+ss];in[4+ss]+=in[3+ss];in[3+ss]+=in[2+ss];
  124.         in[2+ss]+=in[1+ss];in[1+ss]+=in[0+ss];
  125.  
  126.         /* Input aliasing on odd indices (for 6 point IDCT) */
  127.         in[5+ss] += in[3+ss];  in[3+ss]  += in[1+ss];
  128.  
  129.         /* 3 point IDCT on even indices */
  130.  
  131.         pp2 = in[4+ss] * 0.500000000f;
  132.         pp1 = in[2+ss] * 0.866025403f;
  133.         save = in[0+ss] + pp2;
  134.         tmp1 = in[0+ss] - in[4+ss];
  135.         tmp0 = save + pp1;
  136.         tmp2 = save - pp1;
  137.  
  138.         /* End 3 point IDCT on even indices */
  139.  
  140.         /* 3 point IDCT on odd indices (for 6 point IDCT) */
  141.  
  142.         pp2 = in[5+ss] * 0.500000000f;
  143.         pp1 = in[3+ss] * 0.866025403f;
  144.         save = in[1+ss] + pp2;
  145.         tmp4 = in[1+ss] - in[5+ss];
  146.         tmp5 = save + pp1;
  147.         tmp3 = save - pp1;
  148.  
  149.         /* End 3 point IDCT on odd indices */
  150.  
  151.         /* Twiddle factors on odd indices (for 6 point IDCT) */
  152.  
  153.         tmp3 *= 1.931851653f;
  154.         tmp4 *= 0.707106781f;
  155.         tmp5 *= 0.517638090f;
  156.  
  157.         /* Output butterflies on 2 3 point IDCT's (for 6 point IDCT) */
  158.  
  159.         save = tmp0;
  160.         tmp0 += tmp5;
  161.         tmp5 = save - tmp5;
  162.  
  163.         save = tmp1;
  164.         tmp1 += tmp4;
  165.         tmp4 = save - tmp4;
  166.  
  167.         save = tmp2;
  168.         tmp2 += tmp3;
  169.         tmp3 = save - tmp3;
  170.  
  171.         /* End 6 point IDCT */
  172.  
  173.         /* Twiddle factors on indices (for 12 point IDCT) */
  174.  
  175.         tmp0 *= 0.504314480f;
  176.         tmp1 *= 0.541196100f;
  177.         tmp2 *= 0.630236207f;
  178.         tmp3 *= 0.821339815f;
  179.         tmp4 *= 1.306562965f;
  180.         tmp5 *= 3.830648788f;
  181.  
  182.         /* End 12 point IDCT */
  183.  
  184.         /* Shift to 12 point modified IDCT, multiply by window type 2 */
  185.         tmp8  = tmp0 * -0.793353340f;
  186.         tmp9  = tmp0 * -0.608761429f;
  187.         tmp7  = tmp1 * -0.923879532f;
  188.         tmp10 = tmp1 * -0.382683432f;
  189.         tmp6  = tmp2 * -0.991444861f;
  190.         tmp11 = tmp2 * -0.130526192f;
  191.  
  192.         tmp0  = tmp3;
  193.         tmp1  = tmp4 *  0.382683432f;
  194.         tmp2  = tmp5 *  0.608761429f;
  195.  
  196.         tmp3  = tmp5 * -0.793353340f;
  197.         tmp4  = tmp4 * -0.923879532f;
  198.         tmp5  = tmp0 * -0.991444861f;
  199.  
  200.         tmp0 *= 0.130526192f;
  201.  
  202.         out[ss + 6]  += tmp0;
  203.         out[ss + 7]  += tmp1;
  204.         out[ss + 8]  += tmp2;
  205.         out[ss + 9]  += tmp3;
  206.         out[ss + 10] += tmp4;
  207.         out[ss + 11] += tmp5;
  208.         out[ss + 12] += tmp6;
  209.         out[ss + 13] += tmp7;
  210.         out[ss + 14] += tmp8;
  211.         out[ss + 15] += tmp9;
  212.         out[ss + 16] += tmp10;
  213.         out[ss + 17] += tmp11;
  214.  
  215.     }
  216.     if (sb&1) {
  217.         for (i=0;i<18;i+=2) res_p[i]=out[i] + s_p[i];
  218.         for (i=1;i<18;i+=2) res_p[i]=-out[i] - s_p[i];
  219.     } else
  220.         for (i=0;i<18;i++) res_p[i]=out[i] + s_p[i];
  221.     for (i=18;i<36;i++) s_p[i-18]=out[i];
  222.  
  223.     } else {
  224. /*
  225.  * 36 point IDCT ****************************************************************
  226.  */
  227.     float tmp[18];
  228.  
  229.       /* input aliasing for 36 point IDCT */
  230.       in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14]; in[14]+=in[13];
  231.       in[13]+=in[12]; in[12]+=in[11]; in[11]+=in[10]; in[10]+=in[9];
  232.       in[9] +=in[8];  in[8] +=in[7];  in[7] +=in[6];  in[6] +=in[5];
  233.       in[5] +=in[4];  in[4] +=in[3];  in[3] +=in[2];  in[2] +=in[1];
  234.       in[1] +=in[0];
  235.  
  236.       /* 18 point IDCT for odd indices */
  237.       
  238.       /* input aliasing for 18 point IDCT */
  239.       in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9];
  240.       in[9] +=in[7];  in[7] +=in[5];  in[5] +=in[3];  in[3] +=in[1];
  241.       
  242.  
  243. {
  244.    float tmp0,tmp1,tmp2,tmp3,tmp4,tmp0_,tmp1_,tmp2_,tmp3_;
  245.    float tmp0o,tmp1o,tmp2o,tmp3o,tmp4o,tmp0_o,tmp1_o,tmp2_o,tmp3_o;
  246.  
  247. /* Fast 9 Point Inverse Discrete Cosine Transform
  248. //
  249. // By  Francois-Raymond Boyer
  250. //         mailto:boyerf@iro.umontreal.ca
  251. //         http://www.iro.umontreal.ca/~boyerf
  252. //
  253. // The code has been optimized for Intel processors
  254. //  (takes a lot of time to convert float to and from iternal FPU representation)
  255. //
  256. // It is a simple "factorization" of the IDCT matrix.
  257. */
  258.    /* 9 point IDCT on even indices */
  259.    {
  260.    /* 5 points on odd indices (not realy an IDCT) */
  261.    float i0 = in[0]+in[0];
  262.    float i0p12 = i0 + in[12];
  263.  
  264.    tmp0 = i0p12 + in[4]*1.8793852415718f  + in[8]*1.532088886238f   + in[16]*0.34729635533386f;
  265.    tmp1 = i0    + in[4]                   - in[8] - in[12] - in[12] - in[16];
  266.    tmp2 = i0p12 - in[4]*0.34729635533386f - in[8]*1.8793852415718f  + in[16]*1.532088886238f;
  267.    tmp3 = i0p12 - in[4]*1.532088886238f   + in[8]*0.34729635533386f - in[16]*1.8793852415718f;
  268.    tmp4 = in[0] - in[4]                   + in[8] - in[12]          + in[16];
  269.    }
  270.    {
  271.    float i6_ = in[6]*1.732050808f;        
  272.  
  273.    tmp0_ = in[2]*1.9696155060244f  + i6_ + in[10]*1.2855752193731f  + in[14]*0.68404028665134f;
  274.    tmp1_ = (in[2]                        - in[10]                   - in[14])*1.732050808f;
  275.    tmp2_ = in[2]*1.2855752193731f  - i6_ - in[10]*0.68404028665134f + in[14]*1.9696155060244f;
  276.    tmp3_ = in[2]*0.68404028665134f - i6_ + in[10]*1.9696155060244f  - in[14]*1.2855752193731f;
  277.    }
  278.  
  279.    /* 9 point IDCT on odd indices */
  280.    {
  281.    /* 5 points on odd indices (not realy an IDCT) */
  282.    float i0 = in[0+1]+in[0+1];
  283.    float i0p12 = i0 + in[12+1];
  284.  
  285.    tmp0o = i0p12   + in[4+1]*1.8793852415718f  + in[8+1]*1.532088886238f       + in[16+1]*0.34729635533386f;
  286.    tmp1o = i0      + in[4+1]                   - in[8+1] - in[12+1] - in[12+1] - in[16+1];
  287.    tmp2o = i0p12   - in[4+1]*0.34729635533386f - in[8+1]*1.8793852415718f      + in[16+1]*1.532088886238f;
  288.    tmp3o = i0p12   - in[4+1]*1.532088886238f   + in[8+1]*0.34729635533386f     - in[16+1]*1.8793852415718f;
  289.    tmp4o = (in[0+1] - in[4+1]                   + in[8+1] - in[12+1]            + in[16+1])*0.707106781f; /* Twiddled */
  290.    }
  291.    {
  292.    /* 4 points on even indices */
  293.    float i6_ = in[6+1]*1.732050808f;        /* Sqrt[3] */
  294.  
  295.    tmp0_o = in[2+1]*1.9696155060244f  + i6_ + in[10+1]*1.2855752193731f  + in[14+1]*0.68404028665134f;
  296.    tmp1_o = (in[2+1]                        - in[10+1]                   - in[14+1])*1.732050808f;
  297.    tmp2_o = in[2+1]*1.2855752193731f  - i6_ - in[10+1]*0.68404028665134f + in[14+1]*1.9696155060244f;
  298.    tmp3_o = in[2+1]*0.68404028665134f - i6_ + in[10+1]*1.9696155060244f  - in[14+1]*1.2855752193731f;
  299.    }
  300.  
  301.    /* Twiddle factors on odd indices
  302.    // and
  303.    // Butterflies on 9 point IDCT's
  304.    // and
  305.    // twiddle factors for 36 point IDCT
  306.    */
  307.    {
  308.    float e, o;
  309.    e = tmp0 + tmp0_; o = (tmp0o + tmp0_o)*0.501909918f; tmp[0] = (e + o)*(-0.500476342f*.5f);    tmp[17] = (e - o)*(-11.46279281f*.5f);
  310.    e = tmp1 + tmp1_; o = (tmp1o + tmp1_o)*0.517638090f; tmp[1] = (e + o)*(-0.504314480f*.5f);    tmp[16] = (e - o)*(-3.830648788f*.5f);
  311.    e = tmp2 + tmp2_; o = (tmp2o + tmp2_o)*0.551688959f; tmp[2] = (e + o)*(-0.512139757f*.5f);    tmp[15] = (e - o)*(-2.310113158f*.5f);
  312.    e = tmp3 + tmp3_; o = (tmp3o + tmp3_o)*0.610387294f; tmp[3] = (e + o)*(-0.524264562f*.5f);    tmp[14] = (e - o)*(-1.662754762f*.5f);
  313.                                                         tmp[4] = (tmp4 + tmp4o)*(-0.541196100f); tmp[13] = (tmp4 - tmp4o)*(-1.306562965f);
  314.    e = tmp3 - tmp3_; o = (tmp3o - tmp3_o)*0.871723397f; tmp[5] = (e + o)*(-0.563690973f*.5f);    tmp[12] = (e - o)*(-1.082840285f*.5f);
  315.    e = tmp2 - tmp2_; o = (tmp2o - tmp2_o)*1.183100792f; tmp[6] = (e + o)*(-0.592844523f*.5f);    tmp[11] = (e - o)*(-0.930579498f*.5f);
  316.    e = tmp1 - tmp1_; o = (tmp1o - tmp1_o)*1.931851653f; tmp[7] = (e + o)*(-0.630236207f*.5f);    tmp[10] = (e - o)*(-0.821339815f*.5f);
  317.    e = tmp0 - tmp0_; o = (tmp0o - tmp0_o)*5.736856623f; tmp[8] = (e + o)*(-0.678170852f*.5f);    tmp[9] =  (e - o)*(-0.740093616f*.5f);
  318.    }
  319.    }
  320.     /* shift to modified IDCT */
  321.     win_bt = win[win_type];
  322.  
  323.     if (sb&1) {
  324.         res_p[0] =  -tmp[9]  * win_bt[0] + s_p[0];
  325.         res_p[1] =-(-tmp[10] * win_bt[1] + s_p[1]);
  326.         res_p[2] =  -tmp[11] * win_bt[2] + s_p[2];
  327.         res_p[3] =-(-tmp[12] * win_bt[3] + s_p[3]);
  328.         res_p[4] =  -tmp[13] * win_bt[4] + s_p[4];
  329.         res_p[5] =-(-tmp[14] * win_bt[5] + s_p[5]);
  330.         res_p[6] =  -tmp[15] * win_bt[6] + s_p[6];
  331.         res_p[7] =-(-tmp[16] * win_bt[7] + s_p[7]);
  332.         res_p[8] =  -tmp[17] * win_bt[8] + s_p[8];
  333.        
  334.         res_p[9] = -(tmp[17] * win_bt[9] + s_p[9]);
  335.         res_p[10]=  tmp[16] * win_bt[10] + s_p[10];
  336.         res_p[11]=-(tmp[15] * win_bt[11] + s_p[11]);
  337.         res_p[12]=  tmp[14] * win_bt[12] + s_p[12];
  338.         res_p[13]=-(tmp[13] * win_bt[13] + s_p[13]);
  339.         res_p[14]=  tmp[12] * win_bt[14] + s_p[14];
  340.         res_p[15]=-(tmp[11] * win_bt[15] + s_p[15]);
  341.         res_p[16]=  tmp[10] * win_bt[16] + s_p[16];
  342.         res_p[17]=-(tmp[9]  * win_bt[17] + s_p[17]);
  343.     } else {
  344.         res_p[0] = -tmp[9]  * win_bt[0] + s_p[0];
  345.         res_p[1] = -tmp[10] * win_bt[1] + s_p[1];
  346.         res_p[2] = -tmp[11] * win_bt[2] + s_p[2];
  347.         res_p[3] = -tmp[12] * win_bt[3] + s_p[3];
  348.         res_p[4] = -tmp[13] * win_bt[4] + s_p[4];
  349.         res_p[5] = -tmp[14] * win_bt[5] + s_p[5];
  350.         res_p[6] = -tmp[15] * win_bt[6] + s_p[6];
  351.         res_p[7] = -tmp[16] * win_bt[7] + s_p[7];
  352.         res_p[8] = -tmp[17] * win_bt[8] + s_p[8];
  353.        
  354.         res_p[9] = tmp[17] * win_bt[9] + s_p[9];
  355.         res_p[10]= tmp[16] * win_bt[10] + s_p[10];
  356.         res_p[11]= tmp[15] * win_bt[11] + s_p[11];
  357.         res_p[12]= tmp[14] * win_bt[12] + s_p[12];
  358.         res_p[13]= tmp[13] * win_bt[13] + s_p[13];
  359.         res_p[14]= tmp[12] * win_bt[14] + s_p[14];
  360.         res_p[15]= tmp[11] * win_bt[15] + s_p[15];
  361.         res_p[16]= tmp[10] * win_bt[16] + s_p[16];
  362.         res_p[17]= tmp[9]  * win_bt[17] + s_p[17];
  363.     }
  364.  
  365.     s_p[0]= tmp[8]  * win_bt[18];
  366.     s_p[1]= tmp[7]  * win_bt[19];
  367.     s_p[2]= tmp[6]  * win_bt[20];
  368.     s_p[3]= tmp[5]  * win_bt[21];
  369.     s_p[4]= tmp[4]  * win_bt[22];
  370.     s_p[5]= tmp[3]  * win_bt[23];
  371.     s_p[6]= tmp[2]  * win_bt[24];
  372.     s_p[7]= tmp[1]  * win_bt[25];
  373.     s_p[8]= tmp[0]  * win_bt[26];
  374.  
  375.     s_p[9]= tmp[0]  * win_bt[27];
  376.     s_p[10]= tmp[1]  * win_bt[28];
  377.     s_p[11]= tmp[2]  * win_bt[29];
  378.     s_p[12]= tmp[3]  * win_bt[30];
  379.     s_p[13]= tmp[4]  * win_bt[31];
  380.     s_p[14]= tmp[5]  * win_bt[32];
  381.     s_p[15]= tmp[6]  * win_bt[33];
  382.     s_p[16]= tmp[7]  * win_bt[34];
  383.     s_p[17]= tmp[8]  * win_bt[35];
  384.     }
  385. }
  386.  
  387. /* fast DCT according to Lee[84]
  388.  * reordering according to Konstantinides[94]
  389.  */ 
  390. void poly(int ch,int f)
  391. {
  392. static float u[2][2][17][16]; /* no v[][], it's redundant */
  393. static int u_start[2]={0,0}; /* first element of u[][] */
  394. static int u_div[2]={0,0}; /* which part of u[][] is currently used */
  395. int start = u_start[ch];
  396. int div = u_div[ch];
  397. float (*u_p)[16];
  398.  
  399. #if defined(PENTIUM_RDTSC)
  400. unsigned int cnt4, cnt3, cnt2, cnt1;
  401. static int min_cycles = 99999999;
  402.  
  403.     __asm__(".byte 0x0f,0x31" : "=a" (cnt1), "=d" (cnt4));
  404. #endif
  405.  
  406.     {
  407.     float d16,d17,d18,d19,d20,d21,d22,d23,d24,d25,d26,d27,d28,d29,d30,d31;
  408.     float d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15;
  409.  
  410.     /* step 1: initial reordering and 1st (16 wide) butterflies
  411.     */
  412.  
  413.     d0 = res[ 0][f]; d16=(d0  - res[31][f]) *  b1; d0 += res[31][f];
  414.     d1 = res[ 1][f]; d17=(d1  - res[30][f]) *  b3; d1 += res[30][f];
  415.     d3 = res[ 2][f]; d19=(d3  - res[29][f]) *  b5; d3 += res[29][f];
  416.     d2 = res[ 3][f]; d18=(d2  - res[28][f]) *  b7; d2 += res[28][f];
  417.     d6 = res[ 4][f]; d22=(d6  - res[27][f]) *  b9; d6 += res[27][f];
  418.     d7 = res[ 5][f]; d23=(d7  - res[26][f]) * b11; d7 += res[26][f];
  419.     d5 = res[ 6][f]; d21=(d5  - res[25][f]) * b13; d5 += res[25][f];
  420.     d4 = res[ 7][f]; d20=(d4  - res[24][f]) * b15; d4 += res[24][f];
  421.     d12= res[ 8][f]; d28=(d12 - res[23][f]) * b17; d12+= res[23][f];
  422.     d13= res[ 9][f]; d29=(d13 - res[22][f]) * b19; d13+= res[22][f];
  423.     d15= res[10][f]; d31=(d15 - res[21][f]) * b21; d15+= res[21][f];
  424.     d14= res[11][f]; d30=(d14 - res[20][f]) * b23; d14+= res[20][f];
  425.     d10= res[12][f]; d26=(d10 - res[19][f]) * b25; d10+= res[19][f];
  426.     d11= res[13][f]; d27=(d11 - res[18][f]) * b27; d11+= res[18][f];
  427.     d9 = res[14][f]; d25=(d9  - res[17][f]) * b29; d9 += res[17][f];
  428.     d8 = res[15][f]; d24=(d8  - res[16][f]) * b31; d8 += res[16][f];
  429.  
  430.     {
  431.     float c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15;
  432.  
  433. /* a test to see what can be done with memory separation
  434.  * first we process indexes 0-15
  435. */
  436.     c0 = d0 + d8 ; c8 = ( d0 - d8 ) *  b2;
  437.     c1 = d1 + d9 ; c9 = ( d1 - d9 ) *  b6;
  438.     c2 = d2 + d10; c10= ( d2 - d10) * b14;
  439.     c3 = d3 + d11; c11= ( d3 - d11) * b10;
  440.     c4 = d4 + d12; c12= ( d4 - d12) * b30;
  441.     c5 = d5 + d13; c13= ( d5 - d13) * b26;
  442.     c6 = d6 + d14; c14= ( d6 - d14) * b18;
  443.     c7 = d7 + d15; c15= ( d7 - d15) * b22;
  444.     
  445.     /* step 3: 4-wide butterflies
  446.     */
  447.     d0 = c0 + c4 ; d4 = ( c0 - c4 ) *  b4;
  448.     d1 = c1 + c5 ; d5 = ( c1 - c5 ) * b12;
  449.     d2 = c2 + c6 ; d6 = ( c2 - c6 ) * b28;
  450.     d3 = c3 + c7 ; d7 = ( c3 - c7 ) * b20;
  451.     
  452.     d8 = c8 + c12; d12= ( c8 - c12) *  b4;
  453.     d9 = c9 + c13; d13= ( c9 - c13) * b12;
  454.     d10= c10+ c14; d14= (c10 - c14) * b28;
  455.     d11= c11+ c15; d15= (c11 - c15) * b20;
  456.  
  457.  
  458.     /* step 4: 2-wide butterflies
  459.     */
  460.     {
  461.     float rb8 = b8;
  462.     float rb24 = b24;
  463.  
  464. /**/    c0 = d0 + d2 ; c2 = ( d0 - d2 ) *  rb8;
  465.     c1 = d1 + d3 ; c3 = ( d1 - d3 ) * rb24;
  466. /**/    c4 = d4 + d6 ; c6 = ( d4 - d6 ) *  rb8;
  467.     c5 = d5 + d7 ; c7 = ( d5 - d7 ) * rb24;
  468. /**/    c8 = d8 + d10; c10= ( d8 - d10) *  rb8;
  469.     c9 = d9 + d11; c11= ( d9 - d11) * rb24;
  470. /**/    c12= d12+ d14; c14= (d12 - d14) *  rb8;
  471.     c13= d13+ d15; c15= (d13 - d15) * rb24;
  472.     }
  473.  
  474.     /* step 5: 1-wide butterflies
  475.     */
  476.     {
  477.     float rb16 = b16;
  478.  
  479.     /* this is a little 'hacked up'
  480.     */
  481.     d0 = (-c0 -c1) * 2; d1 = ( c0 - c1 ) * rb16; 
  482.     d2 = c2 + c3; d3 = ( c2 - c3 ) * rb16; 
  483.     d3 -= d2;
  484.  
  485.     d4 = c4 +c5; d5 = ( c4 - c5 ) * rb16;
  486.     d5 += d4;
  487.     d7 = -d5;
  488.     d7 += ( c6 - c7 ) * rb16; d6 = +c6 +c7;
  489.  
  490.     d8 = c8 + c9 ; d9 = ( c8 - c9 ) * rb16;
  491.     d11= +d8 +d9;
  492.     d11 +=(c10 - c11) * rb16; d10= c10+ c11; 
  493.  
  494.     d12 = c12+ c13; d13 = (c12 - c13) * rb16;
  495.     d13 += -d8-d9+d12;
  496.     d14 = c14+ c15; d15 = (c14 - c15) * rb16;
  497.     d15-=d11;
  498.     d14 += -d8 -d10;
  499.     }
  500.  
  501.         /* step 6: final resolving & reordering
  502.          * the other 32 are stored for use with the next granule
  503.          */
  504.  
  505.         u_p = (float (*)[16]) &u[ch][div][0][start];
  506.  
  507. /*16*/  u_p[ 0][0] =+d1 ;
  508.         u_p[ 2][0] = +d9 -d14;
  509. /*20*/  u_p[ 4][0] = +d5 -d6;
  510.         u_p[ 6][0] = -d10 +d13;
  511. /*24*/  u_p[ 8][0] =d3;
  512.         u_p[10][0] = -d8 -d9 +d11 -d13;
  513. /*28*/  u_p[12][0] = +d7;
  514.         u_p[14][0] = +d15;
  515.  
  516.         /* the other 32 are stored for use with the next granule
  517.          */
  518.  
  519.         u_p = (float (*)[16]) &u[ch][!div][0][start];
  520.  
  521. /*0*/   u_p[16][0] = d0;
  522.         u_p[14][0] = -(+d8 );
  523. /*4*/   u_p[12][0] = -(+d4 );
  524.         u_p[10][0] = -(-d8 +d12 );
  525. /*8*/   u_p[ 8][0] = -(+d2 );
  526.         u_p[ 6][0] = -(+d8 +d10 -d12 );
  527. /*12*/  u_p[ 4][0] = -(-d4 +d6 );
  528.         u_p[ 2][0] = -d14;
  529.         u_p[ 0][0] = -d1;
  530.     }
  531.  
  532.     {
  533.     float c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15;
  534.  
  535. /* memory separation, second part
  536. */
  537. /* 2
  538. */
  539.         c0=d16 + d24; c8= (d16 - d24) *  b2;
  540.         c1=d17 + d25; c9= (d17 - d25) *  b6;
  541.         c2=d18 + d26; c10= (d18 - d26) * b14;
  542.         c3=d19 + d27; c11= (d19 - d27) * b10;
  543.         c4=d20 + d28; c12= (d20 - d28) * b30;
  544.         c5=d21 + d29; c13= (d21 - d29) * b26;
  545.         c6=d22 + d30; c14= (d22 - d30) * b18;
  546.         c7=d23 + d31; c15= (d23 - d31) * b22;
  547.  
  548. /* 3
  549. */
  550.         d16= c0+ c4; d20= (c0 - c4) *  b4;
  551.         d17= c1+ c5; d21= (c1 - c5) * b12;
  552.         d18= c2+ c6; d22= (c2 - c6) * b28;
  553.         d19= c3+ c7; d23= (c3 - c7) * b20;
  554.  
  555.         d24= c8+ c12; d28= (c8 - c12) *  b4;
  556.         d25= c9+ c13; d29= (c9 - c13) * b12;
  557.         d26= c10+ c14; d30= (c10 - c14) * b28;
  558.         d27= c11+ c15; d31= (c11 - c15) * b20;
  559.  
  560. /* 4
  561. */
  562.         {
  563.         float rb8 = b8;
  564.         float rb24 = b24;
  565.  
  566. /**/    c0= d16+ d18; c2= (d16 - d18) *  rb8;
  567.         c1= d17+ d19; c3= (d17 - d19) * rb24;
  568. /**/    c4= d20+ d22; c6= (d20 - d22) *  rb8;
  569.         c5= d21+ d23; c7= (d21 - d23) * rb24;
  570. /**/    c8= d24+ d26; c10= (d24 - d26) *  rb8;
  571.         c9= d25+ d27; c11= (d25 - d27) * rb24;
  572. /**/    c12= d28+ d30; c14= (d28 - d30) *  rb8;
  573.         c13= d29+ d31; c15= (d29 - d31) * rb24;
  574.         }
  575.  
  576. /* 5
  577. */
  578.         {
  579.         float rb16 = b16;
  580.         d16= c0+ c1; d17= (c0 - c1) * rb16;
  581.         d18= c2+ c3; d19= (c2 - c3) * rb16;
  582.  
  583.         d20= c4+ c5; d21= (c4 - c5) * rb16;
  584.         d20+=d16; d21+=d17;
  585.         d22= c6+ c7; d23= (c6 - c7) * rb16;
  586.         d22+=d16; d22+=d18;
  587.         d23+=d16; d23+=d17; d23+=d19;
  588.  
  589.  
  590.         d24= c8+ c9; d25= (c8 - c9) * rb16;
  591.         d26= c10+ c11; d27= (c10 - c11) * rb16;
  592.         d26+=d24;
  593.         d27+=d24; d27+=d25;
  594.  
  595.         d28= c12+ c13; d29= (c12 - c13) * rb16;
  596.         d28-=d20; d29+=d28; d29-=d21;
  597.         d30= c14+ c15; d31= (c14 - c15) * rb16;
  598.         d30-=d22;
  599.         d31-=d23;
  600.     }
  601.  
  602.     /* step 6: final resolving & reordering 
  603.      * the other 32 are stored for use with the next granule
  604.      */
  605.     
  606.     u_p = (float (*)[16]) &u[ch][!div][0][start];
  607.  
  608.     u_p[ 1][0] = -(+d30 );    
  609.     u_p[ 3][0] = -(+d22 -d26 );
  610.     u_p[ 5][0] = -(-d18 -d20 +d26 );
  611.     u_p[ 7][0] = -(+d18 -d28 );
  612.     u_p[ 9][0] = -(+d28 );
  613.     u_p[11][0] = -(+d20 -d24 );
  614.     u_p[13][0] = -(-d16 +d24 );
  615.     u_p[15][0] = -(+d16 );
  616.  
  617.     /* the other 32 are stored for use with the next granule
  618.      */
  619.  
  620.     u_p = (float (*)[16]) &u[ch][div][0][start];
  621.  
  622.     u_p[15][0] = +d31;
  623.     u_p[13][0] = +d23 -d27;
  624.     u_p[11][0] = -d19 -d20 -d21 +d27;
  625.     u_p[ 9][0] = +d19 -d29;
  626.     u_p[ 7][0] = -d18 +d29;
  627.     u_p[ 5][0] = +d18 +d20 +d21 -d25 -d26;
  628.     u_p[ 3][0] = -d17 -d22 +d25 +d26;
  629.     u_p[ 1][0] = +d17 -d30;
  630.     }
  631.     }
  632.  
  633. #if defined(PENTIUM_RDTSC)
  634.     __asm__(".byte 0x0f,0x31" : "=a" (cnt3), "=d" (cnt4));
  635. #endif
  636.  
  637.     /* we're doing dewindowing and calculating final samples now
  638.      */
  639.  
  640. #if defined(ARCH_i586)
  641.     /* x86 assembler optimisations.  These optimisations are tuned
  642.            specifically for Intel Pentiums. */
  643.  
  644.         asm("movl $15,%%eax\n\t"\
  645.         "1:\n\t"\
  646.     "flds (%0)\n\t"\
  647.     "fmuls (%1)\n\t"\
  648.     "flds 4(%0)\n\t"\
  649.     "fmuls 4(%1)\n\t"\
  650.     "flds 8(%0)\n\t"\
  651.     "fmuls 8(%1)\n\t"\
  652.     "fxch %%st(2)\n\t"\
  653.     "faddp\n\t"\
  654.     "flds 12(%0)\n\t"\
  655.     "fmuls 12(%1)\n\t"\
  656.     "fxch %%st(2)\n\t"\
  657.     "faddp\n\t"\
  658.     "flds 16(%0)\n\t"\
  659.     "fmuls 16(%1)\n\t"\
  660.     "fxch %%st(2)\n\t"\
  661.     "faddp\n\t"\
  662.     "flds 20(%0)\n\t"\
  663.     "fmuls 20(%1)\n\t"\
  664.     "fxch %%st(2)\n\t"\
  665.     "faddp\n\t"\
  666.     "flds 24(%0)\n\t"\
  667.     "fmuls 24(%1)\n\t"\
  668.     "fxch %%st(2)\n\t"\
  669.     "faddp\n\t"\
  670.     "flds 28(%0)\n\t"\
  671.     "fmuls 28(%1)\n\t"\
  672.     "fxch %%st(2)\n\t"\
  673.     "faddp\n\t"\
  674.     "flds 32(%0)\n\t"\
  675.     "fmuls 32(%1)\n\t"\
  676.     "fxch %%st(2)\n\t"\
  677.     "faddp\n\t"\
  678.     "flds 36(%0)\n\t"\
  679.     "fmuls 36(%1)\n\t"\
  680.     "fxch %%st(2)\n\t"\
  681.     "faddp\n\t"\
  682.     "flds 40(%0)\n\t"\
  683.     "fmuls 40(%1)\n\t"\
  684.     "fxch %%st(2)\n\t"\
  685.     "faddp\n\t"\
  686.     "flds 44(%0)\n\t"\
  687.     "fmuls 44(%1)\n\t"\
  688.     "fxch %%st(2)\n\t"\
  689.     "faddp\n\t"\
  690.     "flds 48(%0)\n\t"\
  691.     "fmuls 48(%1)\n\t"\
  692.     "fxch %%st(2)\n\t"\
  693.     "faddp\n\t"\
  694.     "flds 52(%0)\n\t"\
  695.     "fmuls 52(%1)\n\t"\
  696.     "fxch %%st(2)\n\t"\
  697.     "faddp\n\t"\
  698.     "flds 56(%0)\n\t"\
  699.     "fmuls 56(%1)\n\t"\
  700.     "fxch %%st(2)\n\t"\
  701.     "faddp\n\t"\
  702.     "flds 60(%0)\n\t"\
  703.     "fmuls 60(%1)\n\t"\
  704.     "fxch %%st(2)\n\t"\
  705.     "faddp\n\t"\
  706.     "addl $64,%0\n\t"\
  707.     "addl $128,%1\n\t"\
  708.     "subl $4,%%esp\n\t"\
  709.     "faddp\n\t"\
  710.     "fistpl (%%esp)\n\t"\
  711.     "popl %%ecx\n\t"\
  712.     "cmpl $32767,%%ecx\n\t"\
  713.     "jle 2f\n\t"\
  714.     "movw $32767,%%cx\n\t"\
  715.     "jmp 3f\n\t"\
  716.     "2: cmpl $-32768,%%ecx\n\t"\
  717.     "jge 3f\n\t"\
  718.     "movw $-32768,%%cx\n\t"\
  719.     "3: movw %%cx,(%2)\n\t"\
  720.     "addl %3,%2\n\t"\
  721.     "decl %%eax\n\t"\
  722.     "jns 1b\n\t"\
  723.  
  724.     "testb $1,%4\n\t"\
  725.         "je 4f\n\t"
  726.  
  727.     "flds (%0)\n\t"\
  728.     "fmuls (%1)\n\t"\
  729.     "flds 8(%0)\n\t"\
  730.     "fmuls 8(%1)\n\t"\
  731.     "flds 16(%0)\n\t"\
  732.     "fmuls 16(%1)\n\t"\
  733.     "fxch %%st(2)\n\t"\
  734.     "faddp\n\t"\
  735.     "flds 24(%0)\n\t"\
  736.     "fmuls 24(%1)\n\t"\
  737.     "fxch %%st(2)\n\t"\
  738.     "faddp\n\t"\
  739.     "flds 32(%0)\n\t"\
  740.     "fmuls 32(%1)\n\t"\
  741.     "fxch %%st(2)\n\t"\
  742.     "faddp\n\t"\
  743.     "flds 40(%0)\n\t"\
  744.     "fmuls 40(%1)\n\t"\
  745.     "fxch %%st(2)\n\t"\
  746.     "faddp\n\t"\
  747.     "flds 48(%0)\n\t"\
  748.     "fmuls 48(%1)\n\t"\
  749.     "fxch %%st(2)\n\t"\
  750.     "faddp\n\t"\
  751.     "flds 56(%0)\n\t"\
  752.     "fmuls 56(%1)\n\t"\
  753.     "fxch %%st(2)\n\t"\
  754.     "faddp\n\t"\
  755.     "subl $4,%%esp\n\t"\
  756.     "subl $64,%0\n\t"\
  757.     "subl $192,%1\n\t"\
  758.     "faddp\n\t"\
  759.     "fistpl (%%esp)\n\t"\
  760.     "popl %%ecx\n\t"\
  761.     "cmpl $32767,%%ecx\n\t"\
  762.     "jle 2f\n\t"\
  763.     "movw $32767,%%cx\n\t"\
  764.     "jmp 3f\n\t"\
  765.     "2: cmpl $-32768,%%ecx\n\t"\
  766.     "jge 3f\n\t"\
  767.     "movw $-32768,%%cx\n\t"\
  768.     "3: movw %%cx,(%2)\n\t"\
  769.  
  770.     "movl %5,%%ecx\n\t"\
  771.     "sall $3,%%ecx\n\t"\
  772.     "addl %%ecx,%1\n\t"\
  773.     "addl %3,%2\n\t"\
  774.     "movl $14,%%eax\n\t"\
  775.  
  776.     "1:flds 4(%0)\n\t"\
  777.     "fmuls 56(%1)\n\t"\
  778.     "flds (%0)\n\t"\
  779.     "fmuls 60(%1)\n\t"\
  780.     "flds 12(%0)\n\t"\
  781.     "fmuls 48(%1)\n\t"\
  782.     "fxch %%st(2)\n\t"\
  783.     "fsubp\n\t"\
  784.     "flds 8(%0)\n\t"\
  785.     "fmuls 52(%1)\n\t"\
  786.     "fxch %%st(2)\n\t"\
  787.     "faddp\n\t"\
  788.     "flds 20(%0)\n\t"\
  789.     "fmuls 40(%1)\n\t"\
  790.     "fxch %%st(2)\n\t"\
  791.     "fsubrp\n\t"\
  792.     "flds 16(%0)\n\t"\
  793.     "fmuls 44(%1)\n\t"\
  794.     "fxch %%st(2)\n\t"\
  795.     "faddp\n\t"\
  796.     "flds 28(%0)\n\t"\
  797.     "fmuls 32(%1)\n\t"\
  798.     "fxch %%st(2)\n\t"\
  799.     "fsubrp\n\t"\
  800.     "flds 24(%0)\n\t"\
  801.     "fmuls 36(%1)\n\t"\
  802.     "fxch %%st(2)\n\t"\
  803.     "faddp\n\t"\
  804.     "flds 36(%0)\n\t"\
  805.     "fmuls 24(%1)\n\t"\
  806.     "fxch %%st(2)\n\t"\
  807.     "fsubrp\n\t"\
  808.     "flds 32(%0)\n\t"\
  809.     "fmuls 28(%1)\n\t"\
  810.     "fxch %%st(2)\n\t"\
  811.     "faddp\n\t"\
  812.     "flds 44(%0)\n\t"\
  813.     "fmuls 16(%1)\n\t"\
  814.     "fxch %%st(2)\n\t"\
  815.     "fsubrp\n\t"\
  816.     "flds 40(%0)\n\t"\
  817.     "fmuls 20(%1)\n\t"\
  818.     "fxch %%st(2)\n\t"\
  819.     "faddp\n\t"\
  820.     "flds 52(%0)\n\t"\
  821.     "fmuls 8(%1)\n\t"\
  822.     "fxch %%st(2)\n\t"\
  823.     "fsubrp\n\t"\
  824.     "flds 48(%0)\n\t"\
  825.     "fmuls 12(%1)\n\t"\
  826.     "fxch %%st(2)\n\t"\
  827.     "faddp\n\t"\
  828.     "flds 60(%0)\n\t"\
  829.     "fmuls (%1)\n\t"\
  830.     "fxch %%st(2)\n\t"\
  831.     "fsubrp\n\t"\
  832.     "flds 56(%0)\n\t"\
  833.     "fmuls 4(%1)\n\t"\
  834.     "fxch %%st(2)\n\t"\
  835.     "faddp\n\t"\
  836.     "subl $64,%0\n\t"\
  837.     "subl $128,%1\n\t"\
  838.     "subl $4,%%esp\n\t"\
  839.     "fsubp\n\t"\
  840.     "fistpl (%%esp)\n\t"\
  841.     "popl %%ecx\n\t"\
  842.     "cmpl $32767,%%ecx\n\t"\
  843.     "jle 2f\n\t"\
  844.     "movw $32767,%%cx\n\t"\
  845.     "jmp 3f\n\t"\
  846.     "2: cmpl $-32768,%%ecx\n\t"\
  847.     "jge 3f\n\t"\
  848.     "movw $-32768,%%cx\n\t"\
  849.     "3: movw %%cx,(%2)\n\t"\
  850.     "addl %3,%2\n\t"\
  851.     "decl %%eax\n\t"\
  852.     "jns 1b\n\t"\
  853.     "jmp 5f\n\t"\
  854.  
  855.     "4:flds 4(%0)\n\t"\
  856.     "fmuls 4(%1)\n\t"\
  857.     "flds 12(%0)\n\t"\
  858.     "fmuls 12(%1)\n\t"\
  859.     "flds 20(%0)\n\t"\
  860.     "fmuls 20(%1)\n\t"\
  861.     "fxch %%st(2)\n\t"\
  862.     "faddp\n\t"\
  863.     "flds 28(%0)\n\t"\
  864.     "fmuls 28(%1)\n\t"\
  865.     "fxch %%st(2)\n\t"\
  866.     "faddp\n\t"\
  867.     "flds 36(%0)\n\t"\
  868.     "fmuls 36(%1)\n\t"\
  869.     "fxch %%st(2)\n\t"\
  870.     "faddp\n\t"\
  871.     "flds 44(%0)\n\t"\
  872.     "fmuls 44(%1)\n\t"\
  873.     "fxch %%st(2)\n\t"\
  874.     "faddp\n\t"\
  875.     "flds 52(%0)\n\t"\
  876.     "fmuls 52(%1)\n\t"\
  877.     "fxch %%st(2)\n\t"\
  878.     "faddp\n\t"\
  879.     "flds 60(%0)\n\t"\
  880.     "fmuls 60(%1)\n\t"\
  881.     "fxch %%st(2)\n\t"\
  882.     "faddp\n\t"\
  883.     "subl $4,%%esp\n\t"\
  884.     "subl $64,%0\n\t"\
  885.     "subl $192,%1\n\t"\
  886.     "faddp\n\t"\
  887.     "fistpl (%%esp)\n\t"\
  888.     "popl %%ecx\n\t"\
  889.     "cmpl $32767,%%ecx\n\t"\
  890.     "jle 2f\n\t"\
  891.     "movw $32767,%%cx\n\t"\
  892.     "jmp 3f\n\t"\
  893.     "2: cmpl $-32768,%%ecx\n\t"\
  894.     "jge 3f\n\t"\
  895.     "movw $-32768,%%cx\n\t"\
  896.     "3: movw %%cx,(%2)\n\t"\
  897.  
  898.     "movl %5,%%ecx\n\t"\
  899.     "sall $3,%%ecx\n\t"\
  900.     "addl %%ecx,%1\n\t"\
  901.     "addl %3,%2\n\t"\
  902.  
  903.     "movl $14,%%eax\n\t"\
  904.     "1:flds (%0)\n\t"\
  905.     "fmuls 60(%1)\n\t"\
  906.     "flds 4(%0)\n\t"\
  907.     "fmuls 56(%1)\n\t"\
  908.     "flds 8(%0)\n\t"\
  909.     "fmuls 52(%1)\n\t"\
  910.     "fxch %%st(2)\n\t"\
  911.     "fsubp\n\t"\
  912.     "flds 12(%0)\n\t"\
  913.     "fmuls 48(%1)\n\t"\
  914.     "fxch %%st(2)\n\t"\
  915.     "faddp\n\t"\
  916.     "flds 16(%0)\n\t"\
  917.     "fmuls 44(%1)\n\t"\
  918.     "fxch %%st(2)\n\t"\
  919.     "fsubrp\n\t"\
  920.     "flds 20(%0)\n\t"\
  921.     "fmuls 40(%1)\n\t"\
  922.     "fxch %%st(2)\n\t"\
  923.     "faddp\n\t"\
  924.     "flds 24(%0)\n\t"\
  925.     "fmuls 36(%1)\n\t"\
  926.     "fxch %%st(2)\n\t"\
  927.     "fsubrp\n\t"\
  928.     "flds 28(%0)\n\t"\
  929.     "fmuls 32(%1)\n\t"\
  930.     "fxch %%st(2)\n\t"\
  931.     "faddp\n\t"\
  932.     "flds 32(%0)\n\t"\
  933.     "fmuls 28(%1)\n\t"\
  934.     "fxch %%st(2)\n\t"\
  935.     "fsubrp\n\t"\
  936.     "flds 36(%0)\n\t"\
  937.     "fmuls 24(%1)\n\t"\
  938.     "fxch %%st(2)\n\t"\
  939.     "faddp\n\t"\
  940.     "flds 40(%0)\n\t"\
  941.     "fmuls 20(%1)\n\t"\
  942.     "fxch %%st(2)\n\t"\
  943.     "fsubrp\n\t"\
  944.     "flds 44(%0)\n\t"\
  945.     "fmuls 16(%1)\n\t"\
  946.     "fxch %%st(2)\n\t"\
  947.     "faddp\n\t"\
  948.     "flds 48(%0)\n\t"\
  949.     "fmuls 12(%1)\n\t"\
  950.     "fxch %%st(2)\n\t"\
  951.     "fsubrp\n\t"\
  952.     "flds 52(%0)\n\t"\
  953.     "fmuls 8(%1)\n\t"\
  954.     "fxch %%st(2)\n\t"\
  955.     "faddp\n\t"\
  956.     "flds 56(%0)\n\t"\
  957.     "fmuls 4(%1)\n\t"\
  958.     "fxch %%st(2)\n\t"\
  959.     "fsubrp\n\t"\
  960.     "flds 60(%0)\n\t"\
  961.     "fmuls (%1)\n\t"\
  962.     "fxch %%st(2)\n\t"\
  963.     "faddp\n\t"\
  964.     "subl $64,%0\n\t"\
  965.     "subl $128,%1\n\t"\
  966.     "subl $4,%%esp\n\t"\
  967.     "fsubp\n\t"\
  968.     "fistpl (%%esp)\n\t"\
  969.     "popl %%ecx\n\t"\
  970.     "cmpl $32767,%%ecx\n\t"\
  971.     "jle 2f\n\t"\
  972.     "movw $32767,%%cx\n\t"\
  973.     "jmp 3f\n\t"\
  974.     "2: cmpl $-32768,%%ecx\n\t"\
  975.     "jge 3f\n\t"\
  976.     "movw $-32768,%%cx\n\t"\
  977.     "3: movw %%cx,(%2)\n\t"\
  978.     "addl %3,%2\n\t"\
  979.     "decl %%eax\n\t"\
  980.     "jns 1b\n\t"\
  981.  
  982.     "5:"\
  983.         : : "b" (u[ch][div]), "d" (t_dewindow[0] + 16 - start), "S" (&sample_buffer[f>>(2-nch)][nch==2?0:(f&1?16:0)][ch]), "m" (sizeof(short) * nch), "m" (div), "m" (start)\
  984.         : "eax", "ecx", "memory");
  985. #else
  986.     {
  987.       short *samples = (&sample_buffer[f>>(2-nch)][nch==2?0:(f&1?16:0)][ch]);
  988.       int out, j;
  989.  
  990. #define PUT_SAMPLE(out)            \
  991.         if (out > 32767)    \
  992.           *samples = 32767;    \
  993.         else            \
  994.           if (out < -32768)    \
  995.             *samples = -32768;    \
  996.           else            \
  997.             *samples = out;    \
  998.                     \
  999.         samples += nch;
  1000.  
  1001. #if defined(SUPERHACK)
  1002.       /* These is a simple implementation which should be nicer to the
  1003.              cache; computation of samples are done in one pass rather than
  1004.              two.  However, for various reasons which I do not have time to
  1005.              investigate, it runs quite a lot slower than two pass
  1006.              computations.  If you have time, you are welcome to look into
  1007.              it. */
  1008.  
  1009.           {
  1010.             float (*u_ptr)[16] = u[ch][div];
  1011.           const float *dewindow = t_dewindow[0] + 15 - start;
  1012.         const float *dewindow2 = t_dewindow[0] + start;
  1013.  
  1014.         {
  1015.           float outf1, outf2, outf3, outf4;
  1016.  
  1017.           outf1  = u_ptr[0][ 0] * dewindow[0x0];
  1018.           outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1019.           outf3  = u_ptr[0][ 2] * dewindow[0x2];
  1020.           outf4  = u_ptr[0][ 3] * dewindow[0x3];
  1021.           outf1 += u_ptr[0][ 4] * dewindow[0x4];
  1022.           outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1023.           outf3 += u_ptr[0][ 6] * dewindow[0x6];
  1024.           outf4 += u_ptr[0][ 7] * dewindow[0x7];
  1025.           outf1 += u_ptr[0][ 8] * dewindow[0x8];
  1026.           outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1027.           outf3 += u_ptr[0][10] * dewindow[0xa];
  1028.           outf4 += u_ptr[0][11] * dewindow[0xb];
  1029.           outf1 += u_ptr[0][12] * dewindow[0xc];
  1030.           outf2 += u_ptr[0][13] * dewindow[0xd];
  1031.           outf3 += u_ptr[0][14] * dewindow[0xe];
  1032.           outf4 += u_ptr[0][15] * dewindow[0xf];
  1033.  
  1034.           out = outf1 + outf2 + outf3 + outf4;
  1035.  
  1036.           dewindow += 32;
  1037.           dewindow2 += 32;
  1038.           u_ptr++;
  1039.  
  1040.           if (out > 32767)
  1041.         samples[0] = 32767;
  1042.           else
  1043.         if (out < -32768)
  1044.           samples[0] = -32768;
  1045.         else
  1046.           samples[0] = out;
  1047.         }
  1048.  
  1049.             if (div & 0x1) {
  1050.               for (j = 1; j < 16; ++j) {
  1051.                 float outf1, outf2, outf3, outf4;
  1052.  
  1053.                 outf1  = u_ptr[0][ 0] * dewindow[0x0];
  1054.                 outf3  = u_ptr[0][ 0] * dewindow2[0xf];
  1055.                 outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1056.                 outf4  = u_ptr[0][ 1] * dewindow2[0xe];
  1057.                 outf1 += u_ptr[0][ 2] * dewindow[0x2];
  1058.                 outf3 += u_ptr[0][ 2] * dewindow2[0xd];
  1059.                 outf2 += u_ptr[0][ 3] * dewindow[0x3];
  1060.                 outf4 += u_ptr[0][ 3] * dewindow2[0xc];
  1061.                 outf1 += u_ptr[0][ 4] * dewindow[0x4];
  1062.                 outf3 += u_ptr[0][ 4] * dewindow2[0xb];
  1063.                 outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1064.                 outf4 += u_ptr[0][ 5] * dewindow2[0xa];
  1065.                 outf1 += u_ptr[0][ 6] * dewindow[0x6];
  1066.                 outf3 += u_ptr[0][ 6] * dewindow2[0x9];
  1067.                 outf2 += u_ptr[0][ 7] * dewindow[0x7];
  1068.                 outf4 += u_ptr[0][ 7] * dewindow2[0x8];
  1069.                 outf1 += u_ptr[0][ 8] * dewindow[0x8];
  1070.                 outf3 += u_ptr[0][ 8] * dewindow2[0x7];
  1071.                 outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1072.                 outf4 += u_ptr[0][ 9] * dewindow2[0x6];
  1073.                 outf1 += u_ptr[0][10] * dewindow[0xa];
  1074.                 outf3 += u_ptr[0][10] * dewindow2[0x5];
  1075.                 outf2 += u_ptr[0][11] * dewindow[0xb];
  1076.                 outf4 += u_ptr[0][11] * dewindow2[0x4];
  1077.                 outf1 += u_ptr[0][12] * dewindow[0xc];
  1078.                 outf3 += u_ptr[0][12] * dewindow2[0x3];
  1079.                 outf2 += u_ptr[0][13] * dewindow[0xd];
  1080.                 outf4 += u_ptr[0][13] * dewindow2[0x2];
  1081.                 outf1 += u_ptr[0][14] * dewindow[0xe];
  1082.                 outf3 += u_ptr[0][14] * dewindow2[0x1];
  1083.                 outf2 += u_ptr[0][15] * dewindow[0xf];
  1084.                 outf4 += u_ptr[0][15] * dewindow2[0x0];
  1085.  
  1086.                 dewindow += 32;
  1087.                 dewindow2 += 32;
  1088.                 u_ptr++;
  1089.  
  1090.                 out = outf1 + outf2;
  1091.  
  1092.                 if (out > 32767)
  1093.                   samples[j * 2] = 32767;
  1094.                 else
  1095.                   if (out < -32768)
  1096.                     samples[j * 2] = -32768;
  1097.                   else
  1098.                     samples[j * 2] = out;
  1099.  
  1100.                 out = outf4 - outf3;
  1101.  
  1102.                 if (out > 32767)
  1103.                   samples[64 - (j * 2)] = 32767;
  1104.                 else
  1105.                   if (out < -32768)
  1106.                     samples[64 - (j * 2)] = -32768;
  1107.                   else
  1108.                     samples[64 - (j * 2)] = out;
  1109.               }
  1110.  
  1111.               {
  1112.                 float outf2, outf4;
  1113.  
  1114.                 outf2  = u_ptr[0][ 0] * dewindow[0x0];
  1115.                 outf4  = u_ptr[0][ 2] * dewindow[0x2];
  1116.                 outf2 += u_ptr[0][ 4] * dewindow[0x4];
  1117.                 outf4 += u_ptr[0][ 6] * dewindow[0x6];
  1118.                 outf2 += u_ptr[0][ 8] * dewindow[0x8];
  1119.                 outf4 += u_ptr[0][10] * dewindow[0xa];
  1120.                 outf2 += u_ptr[0][12] * dewindow[0xc];
  1121.                 outf4 += u_ptr[0][14] * dewindow[0xe];
  1122.  
  1123.                 out = outf2 + outf4;
  1124.  
  1125.                 if (out > 32767)
  1126.                   samples[16 * 2] = 32767;
  1127.                 else
  1128.                   if (out < -32768)
  1129.                     samples[16 * 2] = -32768;
  1130.                   else
  1131.                     samples[16 * 2] = out;
  1132.               }
  1133.             } else {
  1134.               for (j = 1; j < 16; ++j) {
  1135.                 float outf1, outf2, outf3, outf4;
  1136.  
  1137.                 outf1  = u_ptr[0][ 0] * dewindow[0x0];
  1138.                 outf3  = u_ptr[0][ 0] * dewindow2[0xf];
  1139.                 outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1140.                 outf4  = u_ptr[0][ 1] * dewindow2[0xe];
  1141.                 outf1 += u_ptr[0][ 2] * dewindow[0x2];
  1142.                 outf3 += u_ptr[0][ 2] * dewindow2[0xd];
  1143.                 outf2 += u_ptr[0][ 3] * dewindow[0x3];
  1144.                 outf4 += u_ptr[0][ 3] * dewindow2[0xc];
  1145.                 outf1 += u_ptr[0][ 4] * dewindow[0x4];
  1146.                 outf3 += u_ptr[0][ 4] * dewindow2[0xb];
  1147.                 outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1148.                 outf4 += u_ptr[0][ 5] * dewindow2[0xa];
  1149.                 outf1 += u_ptr[0][ 6] * dewindow[0x6];
  1150.                 outf3 += u_ptr[0][ 6] * dewindow2[0x9];
  1151.                 outf2 += u_ptr[0][ 7] * dewindow[0x7];
  1152.                 outf4 += u_ptr[0][ 7] * dewindow2[0x8];
  1153.                 outf1 += u_ptr[0][ 8] * dewindow[0x8];
  1154.                 outf3 += u_ptr[0][ 8] * dewindow2[0x7];
  1155.                 outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1156.                 outf4 += u_ptr[0][ 9] * dewindow2[0x6];
  1157.                 outf1 += u_ptr[0][10] * dewindow[0xa];
  1158.                 outf3 += u_ptr[0][10] * dewindow2[0x5];
  1159.                 outf2 += u_ptr[0][11] * dewindow[0xb];
  1160.                 outf4 += u_ptr[0][11] * dewindow2[0x4];
  1161.                 outf1 += u_ptr[0][12] * dewindow[0xc];
  1162.                 outf3 += u_ptr[0][12] * dewindow2[0x3];
  1163.                 outf2 += u_ptr[0][13] * dewindow[0xd];
  1164.                 outf4 += u_ptr[0][13] * dewindow2[0x2];
  1165.                 outf1 += u_ptr[0][14] * dewindow[0xe];
  1166.                 outf3 += u_ptr[0][14] * dewindow2[0x1];
  1167.                 outf2 += u_ptr[0][15] * dewindow[0xf];
  1168.                 outf4 += u_ptr[0][15] * dewindow2[0x0];
  1169.  
  1170.                 dewindow += 32;
  1171.                 dewindow2 += 32;
  1172.                 u_ptr++;
  1173.  
  1174.                 out = outf1 + outf2;
  1175.  
  1176.                 if (out > 32767)
  1177.                   samples[j * 2] = 32767;
  1178.                 else
  1179.                   if (out < -32768)
  1180.                     samples[j * 2] = -32768;
  1181.                   else
  1182.                     samples[j * 2] = out;
  1183.  
  1184.                 out = outf3 - outf4;
  1185.  
  1186.                 if (out > 32767)
  1187.                   samples[64 - (j * 2)] = 32767;
  1188.                 else
  1189.                   if (out < -32768)
  1190.                     samples[64 - (j * 2)] = -32768;
  1191.                   else
  1192.                     samples[64 - (j * 2)] = out;
  1193.               }
  1194.  
  1195.               {
  1196.                 float outf2, outf4;
  1197.  
  1198.                 outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1199.                 outf4  = u_ptr[0][ 3] * dewindow[0x3];
  1200.                 outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1201.                 outf4 += u_ptr[0][ 7] * dewindow[0x7];
  1202.                 outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1203.                 outf4 += u_ptr[0][11] * dewindow[0xb];
  1204.                 outf2 += u_ptr[0][13] * dewindow[0xd];
  1205.                 outf4 += u_ptr[0][15] * dewindow[0xf];
  1206.  
  1207.                 out = outf2 + outf4;
  1208.  
  1209.                 if (out > 32767)
  1210.                   samples[16 * 2] = 32767;
  1211.                 else
  1212.                   if (out < -32768)
  1213.                     samples[16 * 2] = -32768;
  1214.                   else
  1215.                     samples[16 * 2] = out;
  1216.               }
  1217.             }
  1218.           }
  1219. #elif defined(HAS_AUTOINCREMENT)
  1220.       const float *dewindow = t_dewindow[0] + 15 - start;
  1221.  
  1222.       /* This is tuned specifically for architectures with
  1223.              autoincrement and -decrement. */
  1224.  
  1225.       {
  1226.         float *u_ptr = (float*) u[ch][div];
  1227.  
  1228.         u_ptr--;
  1229.  
  1230.         for (j = 0; j < 16; ++j) {
  1231.           float outf1, outf2, outf3, outf4;
  1232.  
  1233.           outf1  = *++u_ptr * *++dewindow;
  1234.           outf2  = *++u_ptr * *++dewindow;
  1235.           outf3  = *++u_ptr * *++dewindow;
  1236.           outf4  = *++u_ptr * *++dewindow;
  1237.           outf1 += *++u_ptr * *++dewindow;
  1238.           outf2 += *++u_ptr * *++dewindow;
  1239.           outf3 += *++u_ptr * *++dewindow;
  1240.           outf4 += *++u_ptr * *++dewindow;
  1241.           outf1 += *++u_ptr * *++dewindow;
  1242.           outf2 += *++u_ptr * *++dewindow;
  1243.           outf3 += *++u_ptr * *++dewindow;
  1244.           outf4 += *++u_ptr * *++dewindow;
  1245.           outf1 += *++u_ptr * *++dewindow;
  1246.           outf2 += *++u_ptr * *++dewindow;
  1247.           outf3 += *++u_ptr * *++dewindow;
  1248.           outf4 += *++u_ptr * *++dewindow;
  1249.  
  1250.           out = outf1 + outf2 + outf3 + outf4;
  1251.  
  1252.           dewindow += 16;
  1253.  
  1254.           PUT_SAMPLE(out)
  1255.         }
  1256.  
  1257.         if (div & 0x1) {
  1258.           {
  1259.         float outf2, outf4;
  1260.  
  1261.         outf2  = u_ptr[ 1] * dewindow[0x1];
  1262.         outf4  = u_ptr[ 3] * dewindow[0x3];
  1263.         outf2 += u_ptr[ 5] * dewindow[0x5];
  1264.         outf4 += u_ptr[ 7] * dewindow[0x7];
  1265.         outf2 += u_ptr[ 9] * dewindow[0x9];
  1266.         outf4 += u_ptr[11] * dewindow[0xb];
  1267.         outf2 += u_ptr[13] * dewindow[0xd];
  1268.         outf4 += u_ptr[15] * dewindow[0xf];
  1269.  
  1270.         out = outf2 + outf4;
  1271.  
  1272.         PUT_SAMPLE(out)
  1273.           }
  1274.  
  1275.           dewindow -= 31;
  1276.           dewindow += start;
  1277.           dewindow += start;
  1278.           u_ptr -= 16;
  1279.  
  1280.           for (; j < 31; ++j) {
  1281.         float outf1, outf2, outf3, outf4;
  1282.  
  1283.         outf1  = *++u_ptr * *--dewindow;
  1284.         outf2  = *++u_ptr * *--dewindow;
  1285.         outf3  = *++u_ptr * *--dewindow;
  1286.         outf4  = *++u_ptr * *--dewindow;
  1287.         outf1 += *++u_ptr * *--dewindow;
  1288.         outf2 += *++u_ptr * *--dewindow;
  1289.         outf3 += *++u_ptr * *--dewindow;
  1290.         outf4 += *++u_ptr * *--dewindow;
  1291.         outf1 += *++u_ptr * *--dewindow;
  1292.         outf2 += *++u_ptr * *--dewindow;
  1293.         outf3 += *++u_ptr * *--dewindow;
  1294.         outf4 += *++u_ptr * *--dewindow;
  1295.         outf1 += *++u_ptr * *--dewindow;
  1296.         outf2 += *++u_ptr * *--dewindow;
  1297.         outf3 += *++u_ptr * *--dewindow;
  1298.         outf4 += *++u_ptr * *--dewindow;
  1299.  
  1300.         out = outf2 - outf1 + outf4 - outf3;
  1301.  
  1302.         dewindow -= 16;
  1303.         u_ptr -= 32;
  1304.  
  1305.         PUT_SAMPLE(out)
  1306.           }
  1307.         } else {
  1308.           {
  1309.         float outf2, outf4;
  1310.  
  1311.         outf2  = u_ptr[ 2] * dewindow[ 0x2];
  1312.         outf4  = u_ptr[ 4] * dewindow[ 0x4];
  1313.         outf2 += u_ptr[ 6] * dewindow[ 0x6];
  1314.         outf4 += u_ptr[ 8] * dewindow[ 0x8];
  1315.         outf2 += u_ptr[10] * dewindow[ 0xa];
  1316.         outf4 += u_ptr[12] * dewindow[ 0xc];
  1317.         outf2 += u_ptr[14] * dewindow[ 0xe];
  1318.         outf4 += u_ptr[16] * dewindow[0x10];
  1319.  
  1320.         out = outf2 + outf4;
  1321.  
  1322.         PUT_SAMPLE(out)
  1323.           }
  1324.  
  1325.           dewindow -= 31;
  1326.           dewindow += start;
  1327.           dewindow += start;
  1328.           u_ptr -= 16;
  1329.  
  1330.           for (; j < 31; ++j) {
  1331.         float outf1, outf2, outf3, outf4;
  1332.  
  1333.         outf1  = *++u_ptr * *--dewindow;
  1334.         outf2  = *++u_ptr * *--dewindow;
  1335.         outf3  = *++u_ptr * *--dewindow;
  1336.         outf4  = *++u_ptr * *--dewindow;
  1337.         outf1 += *++u_ptr * *--dewindow;
  1338.         outf2 += *++u_ptr * *--dewindow;
  1339.         outf3 += *++u_ptr * *--dewindow;
  1340.         outf4 += *++u_ptr * *--dewindow;
  1341.         outf1 += *++u_ptr * *--dewindow;
  1342.         outf2 += *++u_ptr * *--dewindow;
  1343.         outf3 += *++u_ptr * *--dewindow;
  1344.         outf4 += *++u_ptr * *--dewindow;
  1345.         outf1 += *++u_ptr * *--dewindow;
  1346.         outf2 += *++u_ptr * *--dewindow;
  1347.         outf3 += *++u_ptr * *--dewindow;
  1348.         outf4 += *++u_ptr * *--dewindow;
  1349.  
  1350.         out = outf1 - outf2 + outf3 - outf4;
  1351.  
  1352.         dewindow -= 16;
  1353.         u_ptr -= 32;
  1354.  
  1355.         PUT_SAMPLE(out)
  1356.           }
  1357.         }
  1358.       }
  1359. #else
  1360.       const float *dewindow = t_dewindow[0] + 16 - start;
  1361.  
  1362.       /* These optimisations are tuned specifically for architectures
  1363.              without autoincrement and -decrement. */
  1364.  
  1365.       {
  1366.         float (*u_ptr)[16] = u[ch][div];
  1367.  
  1368.         for (j = 0; j < 16; ++j) {
  1369.           float outf1, outf2, outf3, outf4;
  1370.  
  1371.           outf1  = u_ptr[0][ 0] * dewindow[0x0];
  1372.           outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1373.           outf3  = u_ptr[0][ 2] * dewindow[0x2];
  1374.           outf4  = u_ptr[0][ 3] * dewindow[0x3];
  1375.           outf1 += u_ptr[0][ 4] * dewindow[0x4];
  1376.           outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1377.           outf3 += u_ptr[0][ 6] * dewindow[0x6];
  1378.           outf4 += u_ptr[0][ 7] * dewindow[0x7];
  1379.           outf1 += u_ptr[0][ 8] * dewindow[0x8];
  1380.           outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1381.           outf3 += u_ptr[0][10] * dewindow[0xa];
  1382.           outf4 += u_ptr[0][11] * dewindow[0xb];
  1383.           outf1 += u_ptr[0][12] * dewindow[0xc];
  1384.           outf2 += u_ptr[0][13] * dewindow[0xd];
  1385.           outf3 += u_ptr[0][14] * dewindow[0xe];
  1386.           outf4 += u_ptr[0][15] * dewindow[0xf];
  1387.  
  1388.           out = outf1 + outf2 + outf3 + outf4;
  1389.  
  1390.           dewindow += 32;
  1391.           u_ptr++;
  1392.  
  1393.           PUT_SAMPLE(out)
  1394.         }
  1395.  
  1396.         if (div & 0x1) {
  1397.           {
  1398.         float outf2, outf4;
  1399.  
  1400.         outf2  = u_ptr[0][ 0] * dewindow[0x0];
  1401.         outf4  = u_ptr[0][ 2] * dewindow[0x2];
  1402.         outf2 += u_ptr[0][ 4] * dewindow[0x4];
  1403.         outf4 += u_ptr[0][ 6] * dewindow[0x6];
  1404.         outf2 += u_ptr[0][ 8] * dewindow[0x8];
  1405.         outf4 += u_ptr[0][10] * dewindow[0xa];
  1406.         outf2 += u_ptr[0][12] * dewindow[0xc];
  1407.         outf4 += u_ptr[0][14] * dewindow[0xe];
  1408.  
  1409.         out = outf2 + outf4;
  1410.  
  1411.         PUT_SAMPLE(out)
  1412.           }
  1413.  
  1414.           dewindow -= 48;
  1415.           dewindow += start;
  1416.           dewindow += start;
  1417.  
  1418.           for (; j < 31; ++j) {
  1419.         float outf1, outf2, outf3, outf4;
  1420.  
  1421.         --u_ptr;
  1422.  
  1423.         outf1  = u_ptr[0][ 0] * dewindow[0xf];
  1424.         outf2  = u_ptr[0][ 1] * dewindow[0xe];
  1425.         outf3  = u_ptr[0][ 2] * dewindow[0xd];
  1426.         outf4  = u_ptr[0][ 3] * dewindow[0xc];
  1427.         outf1 += u_ptr[0][ 4] * dewindow[0xb];
  1428.         outf2 += u_ptr[0][ 5] * dewindow[0xa];
  1429.         outf3 += u_ptr[0][ 6] * dewindow[0x9];
  1430.         outf4 += u_ptr[0][ 7] * dewindow[0x8];
  1431.         outf1 += u_ptr[0][ 8] * dewindow[0x7];
  1432.         outf2 += u_ptr[0][ 9] * dewindow[0x6];
  1433.         outf3 += u_ptr[0][10] * dewindow[0x5];
  1434.         outf4 += u_ptr[0][11] * dewindow[0x4];
  1435.         outf1 += u_ptr[0][12] * dewindow[0x3];
  1436.         outf2 += u_ptr[0][13] * dewindow[0x2];
  1437.         outf3 += u_ptr[0][14] * dewindow[0x1];
  1438.         outf4 += u_ptr[0][15] * dewindow[0x0];
  1439.  
  1440.         out = -outf1 + outf2 - outf3 + outf4;
  1441.  
  1442.         dewindow -= 32;
  1443.  
  1444.         PUT_SAMPLE(out)
  1445.           }
  1446.         } else {
  1447.           {
  1448.         float outf2, outf4;
  1449.  
  1450.         outf2  = u_ptr[0][ 1] * dewindow[0x1];
  1451.         outf4  = u_ptr[0][ 3] * dewindow[0x3];
  1452.         outf2 += u_ptr[0][ 5] * dewindow[0x5];
  1453.         outf4 += u_ptr[0][ 7] * dewindow[0x7];
  1454.         outf2 += u_ptr[0][ 9] * dewindow[0x9];
  1455.         outf4 += u_ptr[0][11] * dewindow[0xb];
  1456.         outf2 += u_ptr[0][13] * dewindow[0xd];
  1457.         outf4 += u_ptr[0][15] * dewindow[0xf];
  1458.  
  1459.         out = outf2 + outf4;
  1460.  
  1461.         PUT_SAMPLE(out)
  1462.           }
  1463.  
  1464.           dewindow -= 48;
  1465.           dewindow += start;
  1466.           dewindow += start;
  1467.  
  1468.           for (; j < 31; ++j) {
  1469.         float outf1, outf2, outf3, outf4;
  1470.  
  1471.         --u_ptr;
  1472.  
  1473.         outf1  = u_ptr[0][ 0] * dewindow[0xf];
  1474.         outf2  = u_ptr[0][ 1] * dewindow[0xe];
  1475.         outf3  = u_ptr[0][ 2] * dewindow[0xd];
  1476.         outf4  = u_ptr[0][ 3] * dewindow[0xc];
  1477.         outf1 += u_ptr[0][ 4] * dewindow[0xb];
  1478.         outf2 += u_ptr[0][ 5] * dewindow[0xa];
  1479.         outf3 += u_ptr[0][ 6] * dewindow[0x9];
  1480.         outf4 += u_ptr[0][ 7] * dewindow[0x8];
  1481.         outf1 += u_ptr[0][ 8] * dewindow[0x7];
  1482.         outf2 += u_ptr[0][ 9] * dewindow[0x6];
  1483.         outf3 += u_ptr[0][10] * dewindow[0x5];
  1484.         outf4 += u_ptr[0][11] * dewindow[0x4];
  1485.         outf1 += u_ptr[0][12] * dewindow[0x3];
  1486.         outf2 += u_ptr[0][13] * dewindow[0x2];
  1487.         outf3 += u_ptr[0][14] * dewindow[0x1];
  1488.         outf4 += u_ptr[0][15] * dewindow[0x0];
  1489.  
  1490.         out = outf1 - outf2 + outf3 - outf4;
  1491.  
  1492.         dewindow -= 32;
  1493.  
  1494.         PUT_SAMPLE(out)
  1495.           }
  1496.         }
  1497.       }
  1498. #endif                                        
  1499.     }
  1500. #endif
  1501.  
  1502.     --u_start[ch];
  1503.     u_start[ch] &= 0xf;
  1504.     u_div[ch]=u_div[ch] ? 0 : 1;
  1505.  
  1506. #if defined(PENTIUM_RDTSC)
  1507.     __asm__(".byte 0x0f,0x31" : "=a" (cnt2), "=d" (cnt4));
  1508.             
  1509.     if (cnt2-cnt1 < min_cycles) {
  1510.       min_cycles = cnt2-cnt1;
  1511.       printf("%d, %d cycles, %d\n", cnt3-cnt1, min_cycles, start);
  1512.     }
  1513. #endif
  1514. }
  1515.  
  1516. void premultiply()
  1517. {
  1518.   int i,t;
  1519.  
  1520.   for (i = 0; i < 17; ++i)
  1521.     for (t = 0; t < 32; ++t)
  1522.       t_dewindow[i][t] *= 16383.5f;
  1523. }
  1524.